import matplotlib.pyplot as plt
#支持中文
plt.rcParams['font.family'] = ['sans-serif']
plt.rcParams['font.sans-serif'] = ['SimHei']
# 数据准备
x = [1, 2, 3, 4, 5]
y = [2, 3, 5, 7, 11]
# 绘制图形
plt.figure(figsize=(8, 6))
plt.plot(x, y)
# 添加文本注释
plt.text(3, 6, '关键点', 
         fontsize=12,
         bbox=dict(facecolor='yellow', alpha=0.5))
# 添加箭头注释
plt.annotate('最高点', 
             xy=(4, 7), 
             xytext=(3, 9),
             arrowprops=dict(facecolor='black', 
                            shrink=0.05,
                            width=1,
                            headwidth=8))
plt.title("添加注释的折线图")
plt.show()
